import request from '../utils/request'

export function getCaptcha() {
    return request({
        url:'user/captcha.jpg',
        method:'get'
    })
}
/**
 * 用户注册
 * @param data
 * @returns {AxiosPromise}
 * @constructor
 */
export function UserRegister(data) {
    return request({
        url:'user/register',
        method: 'post',
        data,
    })
}
/**
 * 用户登陆
 * @returns {never}
 * @constructor
 * @param data
 */
export function UserLogin(data){
    return request({
        url:'user/login',
        method: 'post',
        data,
    })
}

/**
 * 获取用户信息
 * @returns {never}
 * @constructor
 * @param data
 */
export function GetUserInfo(data) {
    return request({
        url:'user/getUserInfo',
        method: 'get',
    })
}

export function addUser(data) {
    return request({
        url:'/user/save',
        method:'post',
        data
    })
}

export function getUserList(nodeId) {
    return request({
        url:'/user/list',
        method:'get',
        params:{
            nodeId:nodeId,
        }
    })
}

/**
 * 删除用户
 * @param id
 */
export function deleteUserById(id) {
    return request({
        url:'/user/deleteById',
        method:'delete',
        params:{
            id:id,
        }
    })
}

/**
 * 冻结用户
 * @param id
 */
export function frozenUserById(id,status) {
    return request({
        url:'/user/frozenById',
        method:'put',
        params:{
            id:id,
            status:status
        }
    })
}

export function editUser(data) {
    return request({
        url:'/user/edit',
        method:'put',
        data,
    })
}
